<!DOCTYPE html>
<html lang="en">

<head>
	<meta charset="utf-8">
	<meta author="zrong.me 曾荣">
	<title>登录 - 有间工作室</title>
	<link rel="stylesheet" type="text/css" href="/static/index/style/register-login.css">
	<link rel="stylesheet" href="/static/index/css/jigsaw.css">
	<script src="https://www.jq22.com/jquery/jquery-1.10.2.js"></script>
	<script src="/static/index/js/vector.js"></script>
	<script>
		$(function () {
			var victor = new Victor("container", "output")
		})
	</script>
</head>

<body id="container">
	<div id="output">
		<div class="cent-box-header">
			<h1 class="main-title hide">有间</h1>
		</div>
		<div class="cent-box">
			<div class="cont-main clearfix">
				<div class="index-tab">
					<div class="index-slide-nav">
						<a href="{{ url_for('.login') }}" class="active">登录</a>
						<a href="{{ url_for('.register') }}">注册</a>
						<div class="slide-bar"></div>
					</div>
				</div>

				<div class="login form">
					<div class="group">
						<div class="group-ipt email">
							<input type="text" name="mobile" id="mobile" class="ipt" placeholder="输入手机号" required>
						</div>
						<div class="group-ipt password">
							<input type="password" name="password" id="password" class="ipt" placeholder="输入您的登录密码"
								required>
						</div>
						<div id="captcha" class="group-ipt" style="position: relative"></div>
					</div>
				</div>

				<div class="button">
					<button type="submit" class="login-btn register-btn" id="button">登 录</button>
				</div>

				<div class="remember clearfix">
{#					<label class="remember-me"><span class="icon"><span class="zt"></span></span><input type="checkbox"#}
{#							name="remember-me" id="remember-me" class="remember-mecheck" checked>记住我</label>#}
					<label class="forgot-password">
						<a href="{{ url_for('.verify') }}">忘记密码？</a>
					</label>
				</div>
			</div>
		</div>
	</div>

	<script src='/static/index/js/background.js' type="text/javascript"></script>
	<script src='/static/index/js/jquery.min.js' type="text/javascript"></script>
	<script src='/static/index/js/layer/layer.js' type="text/javascript"></script>
	<script src='/static/index/js/index.js' type="text/javascript"></script>
	<script src="/static/index/js/jigsaw.js" type="text/javascript"></script>
	<script>

		$("#remember-me").click(function () {
			var n = document.getElementById("remember-me").checked;
			if (n) {
				$(".zt").show();
			} else {
				$(".zt").hide();
			}
		});
		var verify = ""
		jigsaw.init(document.getElementById('captcha'), function () {
			verify = "success";
			layer.msg("验证成功")
		}, function () {
			verify = "loser";
			layer.msg("验证失败")
		})

		$(".login-btn").click(function () {
			var mobile = $("#mobile").val();
			var password = $("#password").val();
			$.ajax({
				url: "{{ url_for('.login') }}",
				type: 'post',
				data: {
					'mobile': mobile,
					'password': password,
					'verify': verify
				},
				success: function (data) {
					// layer.msg(data);
					status = data.status;
					errmsg = data.errmsg;
					layer.msg(errmsg);
					if (status == 0) {
						setTimeout(function () {
							window.location.href = "{{url_for('index_blue.index')}}"
							// history.go(-1)
						}, "1500");

					}
				}
			});

		});
	</script>
</body>

</html>